package org.bite.five_notes.Controller;

import jakarta.annotation.Resource;
import org.bite.five_notes.Service.UserService;
import org.bite.five_notes.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {

//    @Autowired
    private UserService userService;

//    @Autowired
//    @Qualifier("h2")
    @Resource(name = "h2")
    private UserInfo h2;
//    @Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }

    public UserController(){

    }
    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    public void run(){
        userService.sayHi();
    }
    public void sayHi(){
        System.out.println("Hi,UserController...");
        System.out.println(h2    );
    }


}
